import java.util.Arrays;

public class LeetCode283 {
    public static void main(String[] args) {
        int[] arr = {1,0,1};
        moveZeroes(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void moveZeroes(int[] nums) {
        int l = 0,q = 0  ;
        while (nums.length - 1 >= q){
            //快指针等于0时继续往前走，不等于0时快慢指针一起走，但是要互换
            if(nums[q] != 0){
                int t = nums[l];
                nums[l] = nums[q];
                nums[q] = t;
                l++;
            }
            q++;
        }
    }
}
